#include<bits/stdc++.h>
using namespace std;
int n,r[100001],one,two;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>r[i];
    }
    int a=r[1],b=0;
    for(int i=2;i<=n;i++){
        if(r[i]!=a){b=r[i];break;}
    }
    for(int i=1;i<=n;i++){
        if(r[i]!=b&&r[i]!=a)return cout<<2,0;
    }
    for(int i=1;i<=n;i++){
        if(r[i]==a)one++;
        else two++;
    }
    cout<<max(one,two);
    return 0;
}
